#include "stdio.h" // puts()
#include "app.h" // app_init()
#include "string.h" //memset()
#include "trap.h" // trap_init()
#include "proc.h" // proc_init(), run_proc()
#include "clock.h" // clock_init()
#include "pmm.h" // pmm_init()
#include "page.h" // page_init()
#include "fs.h"
#include "sdcard.h"

/* start address and end address of BSS section
 * defined in the linking file "kernel.ld"
 */
extern char sbss[];
extern char ebss[];

void main() {
	// set BSS section to 0
	memset(sbss, 0, ebss - sbss);
	puts("os boot successfully!\n");
	trap_init();
	puts("trap init successfully!\n");
	//clock_init();
	pmm_init();
	puts("pmm init successfully!\n");
	proc_init();
	puts("proc init successfully!\n");
	page_init();
	puts("page init successfully!\n");
	sd_init();
	puts("sdcard init successfully!\n");
	fs_init();
	puts("fs init successfully!\n");
	app_init();
	puts("app init successfully!\n");
	proc_switch();	
}
